package com.example.collegevice.mapper;


import com.example.pojo.College;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface CollegeMapper {
    @Insert("INSERT INTO college(name, content, score) " +
            "VALUES(#{name}, #{content}, #{score})")
    void insert(College college);

    @Select("select * from college")
    List<College> selectAll();

    @Select("select * from college where id = #{college_id}")
    College selectById(Integer college_id);

    @Select("select * from college where name like concat('%', #{name}, '%')")
    List<College> selectByName(String name);
    @Update("UPDATE college SET " +
            "name = #{name}, " +
            "content = #{content}, " +
            "score = #{score} " +
            "WHERE id = #{id}")
    void updateById(College college);

    @Delete("delete from college where id = #{id}")
    void deleteById(Integer id);
}
